import url from '@/tool/index.js'
export const wxindex = (page=1,cartype=1) => { //
	return new Promise(resolve => {
		uni.request({
			url: url+'/api/index/wxindex',
			data: {
				// token:uni.getStorageSync('userToken')
				page:page,
				cartype:cartype
			},
			method: 'POST',
			success: (res) => resolve(res.data),
		});
	})
}

export const coupon = () => { //优惠券
	return new Promise(resolve => {
		uni.request({
			url: url+'/api/index/coupon',
			data: {
				token:uni.getStorageSync('userToken')
			},
			header:{
				'Content-Type':'application/x-www-form-urlencoded'
			},
			method: 'POST',
			success: (res) => resolve(res.data),
		});
	})
}

export const getCoupon = (couponid) => { //优惠券
	return new Promise(resolve => {
		uni.request({
			url: url+'/api/index/getCoupon',
			data: {
				couponid:couponid,
				token:uni.getStorageSync('userToken')
			},
			header:{
				'Content-Type':'application/x-www-form-urlencoded'
			},
			method: 'POST',
			success: (res) => resolve(res.data),
		});
	})
}

